$(function() {
    $.ajax(baseurl + '/slides', {
        success: function(res) {
            // console.log('轮播数据：', res);
            // console.log(baseurl);
            const newhtml = template('swipeid', { swipelist: res, baseurl: baseurl })
                // console.log(newhtml);
            $(' .swipe-wrapper ').html(newhtml)
            var swiper = Swipe(document.querySelector('.swipe'), {
                auto: 3000,
                transitionEnd: function(index) {
                    $('.cursor span').eq(index).addClass('active').siblings('.active').removeClass('active');
                }
            })
            $('.swipe .arrow').on('click', function() {
                var thsi = $(this)
                if (thsi.is('.prev')) {
                    swiper.next()
                } else if (thsi.is('.next')) {
                    swiper.next()
                }
            })
        },
        error: function(e) {
            console.log('err:', e);
        }
    })
})